#include "SaPopCalls.h" SaCallbackStruct* SaMakeCbsColList(SaCallbackStruct *cbs, pSutList colList);
cbs
colList
cbs
is NULL or if the column specification is invalid.
The colList
parameter specifies which columns from the first group in cbs
to use when making the return SaCallbackStruct.
If cbs
is NULL, colList
is NULL, or colList
is an empty list, a NULL pointer is returned.
Use SaFreeCbs() to deallocate the returned SaCallbackStruct when it is no longer needed.
The returned SaCallbackStruct structure should be considered read-only data. Also, the actual data values in the structure should only be used while the underlying data is valid. This is usually after the Population callback function returns, although it may extend beyond that if the data is cached and not overwritten.
The colList
must be assembled using:
list = SutNewList();Followed by:
SutAddList(list, (void *)i);Where
list
is a pSutList
and i
is an integer value representing a column in an SaCallbackStruct
.
SutAddList
should be called once for each column to be returned in the SaCallbackStruct. Columns can be re-ordered by changing their order in the pSutList.
To free the pSutList use SutDeleteList
, not SutDestroyList
!
There are many functions to support SutLists which are listed in See Also.
#include "SaConsoleCalls.h" void MyPopulateList(wid) Widget wid; { pSutList colList; SaCallbackStruct *cbs, *lcbs; char *stmt = "select * from titles"; cbs = SaExecSQL("SYBASE", "pubs2", SGESYBASE, stmt); list = SutNewList(); SutAddList(list, (void *)2); /* put col 2 first */ SutAddList(list, (void *)1); /* put col 1 next */ SutAddList(list, (void *)0); /* put col 0 next */ SutAddList(list, (void *)6); /* put col 6 last */ lcbs = SaMakeCbsColList(cbs, list); SutDeleteList(list); SaPopulateList(wid, lcbs, NULL); SaFreeCbs(lcbs); SaFreeCbs(cbs); }